package br.com.assemble.hermeserp.model.pojos.enderecamento;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import br.com.assemble.hermeserp.ejb.annotation.DaoClass;
import br.com.assemble.hermeserp.model.BasePojo;
import br.com.assemble.hermeserp.model.pojos.comercial.Divisao;


/**
 * The persistent class for the UNIDADES database table.
 * 
 */
@Entity
@Table(name="UNIDADES")
@DaoClass(value="UnidadeDao", pu="hermes-pu")
public class Unidade extends BasePojo implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="UND_IDENTIFY", unique=true, nullable=false)
	private BigInteger undIdentify;

	@Column(name="UND_CODIGO_IBGE", nullable=false)
	private Integer undCodigoIbge;

	@Column(name="UND_NOME", nullable=false, length=100)
	private String undNome;

	@Column(name="UND_SIGLA", unique=true, nullable=false, length=2)
	private String undSigla;

	//bi-directional many-to-one association to Divisao
	@OneToMany(mappedBy="unidade")
	private List<Divisao> divisaoCollection;

	//bi-directional many-to-one association to Municipio
	@OneToMany(mappedBy="unidade")
	private List<Municipio> municipios;

	//bi-directional many-to-one association to Pais
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="PAI_IDENTIFY", nullable=false)
	private Pais pais;

    public Unidade() {
    }

	public BigInteger getUndIdentify() {
		return this.undIdentify;
	}

	public void setUndIdentify(BigInteger undIdentify) {
		this.undIdentify = undIdentify;
	}

	public Integer getUndCodigoIbge() {
		return this.undCodigoIbge;
	}

	public void setUndCodigoIbge(Integer undCodigoIbge) {
		this.undCodigoIbge = undCodigoIbge;
	}

	public String getUndNome() {
		return this.undNome;
	}

	public void setUndNome(String undNome) {
		this.undNome = undNome;
	}

	public String getUndSigla() {
		return this.undSigla;
	}

	public void setUndSigla(String undSigla) {
		this.undSigla = undSigla;
	}

	public List<Divisao> getDivisaoCollection() {
		return this.divisaoCollection;
	}

	public void setDivisaoCollection(List<Divisao> divisaoCollection) {
		this.divisaoCollection = divisaoCollection;
	}
	
	public List<Municipio> getMunicipios() {
		return this.municipios;
	}

	public void setMunicipios(List<Municipio> municipios) {
		this.municipios = municipios;
	}
	
	public Pais getPais() {
		return this.pais;
	}

	public void setPais(Pais pais) {
		this.pais = pais;
	}
	
}